| IaaS | PaaS | SaaS | FaaS |
|---|---|---|---|
| EC2, ASG | RDS, Route53, ALB, SQS, SES | DataDog, Sumologic, Okta | Lambda |
| API | Worker | Scheduler |
|---|---|---|
| Swagger, NGINX, Gunicorn, Flask, SQLAlchemy | Providers' API wrapper | Lambda using Zappa |
class Connection(object):
@staticmethod
def factory(connection):
if not connection.get('ctype'):
try:
evaluator = ConnectionEvaluator.factory(connection)
connection['ctype'] = evaluator.evaluate()
except (VpcPeeringLimitReached, CIDROverlap):
raise ProcessConnectionUnrecoverableError
if connection['ctype'] == 'AWS_PEERING':
return AWSPeeringConnection(connection)
...
else:
raise NotImplementedError("Unknown connection type: {}".format(connection['ctype']))
class AWSPeeringConnection(Connection):
def __init__(self, connection):
super(AWSPeeringConnection, self).__init__(connection)
...def create(self):
try:
if self.peering_id is not None:
raise GSNVPCPeeringUnrecoverableError(
'An peering id {} should not be provided when creating a VPCPeering'.format(self.peering_id))
if self._already_present():
raise GSNVPCPeeringUnrecoverableError('VPC Peering betwen {} and {} already present'.format(
self.left_vpc.vpc_id, self.right_vpc.vpc_id))
response = self.left_vpc.ec2_client.create_vpc_peering_connection(
VpcId=self.left_vpc.vpc_id,
PeerOwnerId=self.right_vpc.account_id,
PeerVpcId=self.right_vpc.vpc_id,
PeerRegion=self.right_vpc.region_name,
)
self._peering_id = response['VpcPeeringConnection']['VpcPeeringConnectionId']
...